import store from '@/store'
// 按需导出图片错误指令
export const imgerror =  {
  inserted(el, binding) {
    el.onerror = () => {
      el.src = binding.value
    }
  }
}

// 控制按钮权限
export const pms =  {
  inserted(el, binding) {
    const { points } = store.state.user.userInfo.roles
    if (!points.some(item => item === binding.value)) {
      // 注意：按钮的显示与隐藏不能通过display:none,
      // 要真正的移除元素
      // el.style.display = 'none'
      el.parentNode.removeChild(el)
    }
  }
}
